<template>
  <div style="border: solid 20px rgb(245, 247, 249)">
    <Table border :columns="columns" :data="watchList">
      <template #status="{ row }">
        {{ row.status == 0 ? "已支付" : "未支付" }}
      </template>
      <template #provider="{ row }">
        {{ row.status == "wxpay" ? "微信支付" : "其他" }}
      </template>
      <template #refund_count="{ row }">
        {{ row.status > "0" ? "已退费" : "未退费" }}
      </template>
    </Table>
  </div>
</template>
<script>
// import {list} from "../../Api/fund.js"
export default {
  created() {
    this.$axios
      .get("http://unicloud.codecore.cn/admin/payWaterList")
      .then((res) => {
        this.watchList = res.data.data;
        console.log(this.watchList);
        this.zz();
      });
    
  },
  data() {
    return {
      columns: [
        {
          title: "ip",
          key: "client_ip",
        },
        {
          title: "订单号",
          key: "order_no",
        },
        {
          title: "订单创建时间",
          key: "create_date",
        },
        {
          title: "流水号",
          key: "out_trade_no",
        },
        {
          title: "完成支付时间",
          key: "pay_date",
        },
        {
          title: "支付状态",
          key: "status",
          slot: "status",
        },
        {
          title: "支付金额",
          key: "total_fee",
        },
        {
          title: "支付方式",
          key: "provider",
          slot: "provider",
        },
        {
          title: "是否退费",
          key: "refund_count",
          slot: "refund_count",
        },
        {
          title: "退费金额",
          key: "refund_fee",
        },
      ],
      watchList: [],
    };
  },
  methods: {
    // 时间戳转换
    zz(strDate) {
      console.log(this.watchList);
      for (let i = 0; i < this.watchList.length; i++) {
        var date = new Date(this.watchList[i].create_date);
        var Y = date.getFullYear() + "-";
        var M =
          (date.getMonth() + 1 < 10
            ? "0" + (date.getMonth() + 1)
            : date.getMonth() + 1) + "-";
        var D =
          (date.getDate() < 10 ? "0" + date.getDate() : date.getDate()) + " ";

        var h =
          (date.getHours() < 10 ? "0" + date.getHours() : date.getHours()) +
          ":";
        var m =
          (date.getMinutes() < 10
            ? "0" + date.getMinutes()
            : date.getMinutes()) + ":";
        var s =
          date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
        var strDate = Y + M + D + h + m + s;
        console.log("输出内容:", strDate);
        this.watchList[i].create_date = strDate
      }
    },
  },
};
</script>